package main

import (
	"flag"
	"fmt"
)

func main() {
	//简单理解 把参数放到一个对应数组里 名字为下标 然后给程序使用
	var ip = flag.Int("flagname", 1234, "help message for flagname")
	fmt.Println("ip has value ", *ip)

	var flagvar int
	flag.IntVar(&flagvar, "dd", 456, "help message for flagname")
	fmt.Println("flagvar has value ", flagvar)

	//输出
	//ip has value  1234
	//flagvar has value  456

	//flag.Parse()
	//fmt.Println(flag.Arg(1))
	//var flagVal flag.Value
	//flag.Var(&flagVal, "name", "help message for flagname")
}
